package com.example.day16.ex05;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;

public class ArrayListIncludeHashMapDemo {
    public static void main(String[] args) {
        ArrayList<HashMap<String,String>> array = new ArrayList<>();
        HashMap<String,String> hm1 = new HashMap<>();
        hm1.put("name","zhangsan");
        hm1.put("age","18");
        array.add(hm1);
        HashMap<String,String> hm2 = new HashMap<>();
        hm2.put("name","lisi");
        hm2.put("age","19");
        array.add(hm2);
        HashMap<String,String> hm3 = new HashMap<>();
        hm3.put("name","wangwu");
        hm3.put("age","20");
        array.add(hm3);
        for (HashMap<String,String> hm : array) {
            Set<String> keySet = hm.keySet();
            for (String key : keySet) {
                String value = hm.get(key);
                System.out.println(key+":"+value);
            }
        }
    }
}
